#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
using namespace std;

class Solution {
public:
    int findPoisonedDuration(vector<int>& timeSeries, int duration) {
        int sum = 0;
        int end = -1;
        for (auto& num : timeSeries)
        {
            if (num > end)
            {
                end = num + duration - 1;
                sum += duration;
            }
            else
            {
                int tmp = num + duration - 1;
                sum += (tmp - end);
                end = tmp;
            }
        }
        return sum;
    }
};

int main() {
    return 0;
}